Repository navigation
fix(objectql,metadata-protocol)!: a stored row bound to a package lives in that package's own registry slot, so each address serves its own row in every order (ADR-0150 D3/D4) - #33513
Conversation
…es in that package's own registry slot (ADR-0150 D3/D4) The registry kept one bare slot per name for a stored row, so the row saved or hydrated last took it. Each row bound to a package (its own, or its .custom pair's by the pair-row rule) of a type the registry reads by package now registers in that package's overlay slot, beside the code artifact's composite entry, which it never overwrites. - each package's exact read and registry item answer its own row in every registration, save and row order, before and after a restart, on the writer and on its peers; - a pair address of a name held only as stored rows answers its base's row; - the read naming no package of a package's row beside its pair's undeclared row serves the package's own row in both orders; - the read naming no package of an action two packages hold only as stored rows refuses 409 naming both after a restart, as every other type already did (the narrowing); - a bundle member two packages hold only as stored rows is no clash, as when one slot held one of them. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
…ngine-double ledger Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn
📓 Docs Drift CheckThis PR changes 3 package(s): 36 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 15 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 175 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin fd04e4b7fbb4da7048b3f0ec2955ea834760171e && git checkout fd04e4b7fbb4da7048b3f0ec2955ea834760171e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e40cd1e28dd79e60e7f4be0db06f071f3f962574 8d85d2b1afb2d6e89d6c28ee0f3aa64c9b427585 && git checkout -B drift-repro e40cd1e28dd79e60e7f4be0db06f071f3f962574 && git merge --no-ff 8d85d2b1afb2d6e89d6c28ee0f3aa64c9b427585
node scripts/docs-audit/affected-docs.mjs --json e40cd1e28dd79e60e7f4be0db06f071f3f962574
|
|
domain:server#5 · os-elon-musk · session_016WV4cy1y7UNVbT2QAdmgdn Request: review · area E1 · head 8d85d2b · 2026-11-14T23:16Z |
|
Contract-review-claim: session_016WV4cwxS1ZpSu2hAMRcqbt · head 8d85d2b · 2026-11-14T23:16Z review#1 (E1) takes this head. |
Contract reviewServed-tier: Face: schema (a ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
#33131 (asked by the author): this PR closes that card's remaining carried face (comment 6870666736, the both-overridden registry item), and the flipped pin proves it. Two items are still open on the card (comment 6878816309): nit N1 of record 6878787461 (unmeasured), and the Implemented-by: VERDICT: PASS |
…object as served, refusing a bad follow pair at the run that completes it (objectstack-ai#33621) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DEdLnXfTK9TPVHPSUQcDnQS)_ Fixes objectstack-ai#33593 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: none — `skills/objectstack-data/rules/field-types.md` already teaches the follow pair with no extension exemption; an extension now meets that same rule, so the docs do not move. ## 维护者速读 - **改了什么**:扩展包(`objectExtensions` / `object_extension`)新增的 record 币种金额字段,现在按"对象实际对外服务的样子"(基础层 + 已启用扩展 + 本次正文)判定其跟随的父对象币种字段;运行结束、批量写入、单条保存三处同一规则。 - **为什么改**:以前扩展层只判自己的汇总字段就提前返回,坏的跟随对(父字段无币种码、字段不存在、经扩展自建的主从字段)被放行,之后父对象的无改动升级反而被 422 拒绝,错怪了无辜的包。 - **风险与回滚**:收紧(narrowing)——此前能装上的坏扩展现在 422;无改动升级不再因"旧坏对"被拒(放宽)。回滚即回退本 PR;无存量数据迁移(维护者 2026-11-14:暂无生产客户)。另:`object_extension` 单条保存现在同时经过 D6 汇总门(两个方向),此前存下后只告警的币种汇总改为 422。 - **先看**:`packages/objectql/src/registry.ts` 的 `recordCurrencyFollowRefusalOf` / `servedFoldWithLayer`(折叠与"之前"对比);`packages/objectql/src/record-currency-aggregate-door.ts` 的 `recordCurrencyFollowRefusal`(差分判定);`packages/metadata-protocol/src/protocol-save.ts` 新增的 `object_extension` 单条保存提问。 - **两分钟验证**:`pnpm --filter @objectstack/objectql exec vitest run --project local src/manifest-service-artifact-refusal-restores.test.ts src/protocol-batch-object-registration.test.ts`,预期全绿,其中 `[objectstack-ai#33593]` 两个 describe 覆盖 R1–R7。 - **需要你做的**:契约复审(`Metadata-protocol: narrowed`)一次;R7 范围已由席位 5 裁定为 A(只管 install/upgrade/reload 这类 run)。 ## What changes The record-currency follow door (ADR-0144 D2 and D6, amended) asked an `extend` layer with `partial: true`, judged only its own roll-ups, and returned before the following-amount half and the other-ends half. An extension-only package could therefore add a record-mode amount following a parent field with no ISO 4217 code, a missing field, or a field reached through its own new master_detail, and it was admitted and served; a later no-change upgrade of the parent's owner was then refused 422 over the extension's field. Implementing the seat ruling (A, amended), R1–R7: - **R1 — every layer judged as the served fold.** `SchemaRegistry.recordCurrencyFollowRefusalOf` now builds the object as `resolveObject` would serve it with the incoming layer in its slot (`servedFoldWithLayer`: one owner, one overlay, one extension per package; a disabled package's extension withheld, as the served fold withholds it) and hands that fold to the door. The door's `partial` and `extensionFieldsOf` are gone: the fold already holds every enabled extension's fields, so the own-body loop and the other-ends loop both read them. - **R2** — an object no owner serves yields no fold, so no verdict (unchanged). - **R3** — no order is exempt: the owner registering after an extension judges the extension's amounts as its own (the fold), at run end, in the batch writer and on single save. - **R4** — an extension arriving before the parent's code field exists is refused like an own body. - **R5** — the followed field is read from the served parent: a missing or disabled supplier extension means refusal; the same supplier in the same artifact passes at the run end. - **R6** — a parent upgrade that removes or de-codes a followed field is refused; when the amount is an extension's, the sentence now names it: `'PARENT' does not hold the code a registered amount follows: 'CHILD.FIELD', which package 'PKG' adds to 'CHILD'.` followed by the door's own words. New view member `extensionPackageOf`. - **R7** — a no-change upgrade is never refused. The door now takes a `before` reading (the object served with what the layer's slot held before) and refuses only a refusal that reading does not already hold. At run end `before` is the contributor the run replaced (`RunRegisteredObject.replaced`, captured in `registerObject`, the earliest kept when a run writes one slot twice); on single save and in the batch writer it is the slot left empty, so a pair the layer itself completes is still refused. The two readings are compared by PAIR, not by sentence: the key is the kind, the declaring object and field, and the target (for a following amount the object its master_detail reaches plus the pointer; for a roll-up the child object and field), so an upgrade that re-points the master_detail onto another parent lacking the code makes a new pair and is refused: for the child's owner as on `main`; for an extension package re-pointing its own master_detail this moves FROM installed (`main` never asked an extension layer's following half) TO refused 422. - **Single save of an `object_extension` item** never asked the follow door (measured on this branch before the hunk: the published save answered 200 and served the bad amount). `protocol-save.ts` now asks `objectRegistrationRefusal(..., 'extend', { againstRegistry: true })` for a published `object_extension` save on an against-registry face (`saveRegistryQuestion`), the same faces that ask it of an `object` body. - Changeset (minor: objectql, metadata-protocol, spec) with `registered record-currency-follow-extension-judged-as-served`, a new semantic ledger entry. ### Clause-② table (each moved answer FROM → TO) Orders: **A** = owner and parent installed first, extension after; **B** = extension first (no verdict while nothing owns the object), owner after. | Case | Order | Run end | Batch writer | Single save | |---|---|---|---|---| | extension amount follows a parent field with no code | A | admitted → refused 422 | admitted → refused 422 | admitted (door never asked) → refused 422 | | extension amount follows a missing field | A | admitted → refused 422 | admitted → refused 422 (same door, not pinned separately) | admitted → refused 422 (same door, not pinned separately) | | extension amount through its own new master_detail | A | admitted → refused 422 | admitted → refused 422 (same door, not pinned separately) | admitted → refused 422 (same door, not pinned separately) | | owner registering under a bad extension | B | admitted → refused 422 | admitted → refused 422 | admitted → refused 422 | | supplier extension missing / disabled | A | admitted → refused 422 | not pinned | not pinned | | parent upgrade removes / de-codes a followed field | — | refused → refused (sentence names the extension's package and field) | not pinned | not pinned | | no-change upgrade over a pair a cold boot admitted | — | refused 422 → installed | unchanged (main's empty-slot answer) | unchanged (main's empty-slot answer) | | unchanged child under a parent's `record` roll-up a cold boot admitted | — | refused 422 → installed | unchanged (main's empty-slot answer) | unchanged (main's empty-slot answer) | | extension package's own no-change upgrade over an amount a cold boot admitted | — | (newly judged) → installed | n/a | n/a | | parent upgrade that only adds an unrelated code field, pair unchanged | — | refused 422 → installed (pair compared, not the sentence) | n/a | n/a | | upgrade of the child's owner that only re-points the pair's master_detail onto another parent lacking the code, pointer string unchanged | — | refused 422 → refused 422 (unchanged; the pair key names the followed object) | n/a | n/a | | upgrade of an extension package that only re-points its own master_detail onto another parent lacking the code, pointer string unchanged | — | installed (`main` never asked an extension layer's following half) → refused 422 (the pair key names the followed object) | n/a | n/a | | re-publish of an UNCHANGED extension whose amount a cold boot admitted | — | n/a | saved → refused 422 | saved (200) → refused 422 | | `object_extension` adding a `sum`/`avg`/`min`/`max` roll-up of a child amount declared `currencyMode: 'record'` (in each row's own currency, or following a parent's code but not read on that parent through the master_detail it follows), or adding such an amount that a registered parent's roll-up reads (D6's roll-up door, both directions) | — | unchanged | unchanged (already asked) | stored, 200, registration warned → refused 422, nothing stored | FROM readings: run end measured on `main` by the area's earlier report (M1–M3 admitted, C2 refused) and by the two pins this PR flips; single save measured on this branch before the `protocol-save.ts` hunk; batch writer FROM read from `main`'s door (`partial` returns before the following half), not separately measured. CONTROLs (unchanged, pinned): the same amount in an own object body is refused 422; a package that owns the parent and extends the child in one install is refused 422; an extension following the parent's code installs and is served. ## Tests New top-level describes: - `manifest-service-artifact-refusal-restores.test.ts` — `[objectstack-ai#33593] an extension's record-mode amount is judged against its object as served, at the end of the run`: the three bad shapes (refused 422 + nothing left), CONTROL good extension, CONTROL own body, CONTROL parent + extension together, R3 both orders, R4, R5 missing / disabled / same artifact, R6 removal and de-code (sentence names the package and field), R6 an extension upgrade re-pointing its own master_detail onto another bad parent (refused), R7 no-change upgrades of both owners. - `protocol-batch-object-registration.test.ts` — `[objectstack-ai#33593] an extension's record-mode amount on a single save and in the batch writer`: published `object_extension` save on `meta-envelope` refused 422 and nothing stored (plus CONTROL), the owner's single-save question in order B, and the batch writer's registered-row question asked of both ends (plus CONTROL). Moved pins (Clause-② evidence, both renamed with the ruling id): `a package that holds only the parent ... upgrade that changes nothing` and `a package that holds only the child installs an unchanged child under a record roll-up` now install (R7); a new CONTROL pins that the child's upgrade that CHANGES the pair under that roll-up is still refused, and another that a child upgrade re-pointing its master_detail onto another bad parent (same pointer string) is still refused. The extension package's own re-point (`manifest-service-artifact-refusal-restores.test.ts:982`, not a CONTROL) is a moved answer: installed on `main`, refused 422 here. ## Acceptance notes - **Review #3 delta-2 (comment 6889470504) fixes, at `31e745afc`, text only:** M1: the changeset's re-point sentence now scopes "as before" to the child's owner and says the same re-point upgrade of an extension package moves FROM installed (`main` never asked an extension layer's following half) TO refused 422; this table splits that row in two and the R7 bullet says the same. The TO is held by the existing pin `manifest-service-artifact-refusal-restores.test.ts:982`. N1: the changeset's R7 parenthetical now gives the key for a following amount and for a roll-up (the declaring object and field, and the child object and field it reads). No code changed; `check:adr-0087-registration`, `check:spec-changes`, `check:upgrade-guide`, `check:empty-changeset`, `check:changeset-fixed`, `check:nul-bytes`: exit 0. - **Review #3 delta (comment 6888891782) fixes, at `c29899531`:** M1 (text): the changeset's D6 line, this table's last row and the entry's `surface` now say the child amount is declared `currencyMode: 'record'` (in each row's own currency, or following a parent's code but not read on that parent through the master_detail it follows), and name D6's second direction (a registered parent's roll-up over an amount the extension adds); the `registry-question.ts` header says the same. M2 (code + pin): the `follow` pair key now carries the object the pointer's master_detail reaches (`record-currency-aggregate-door.ts:596`, `:615`); pinned at `manifest-service-artifact-refusal-restores.test.ts:601` (child upgrade re-pointing `invoice` from `suite_invoice` to `suite_other`, refused 422, Billing stays at 1.0.0) and `:982` (the extension's own `inv2` re-pointed, refused 422). Ablation of the own-loop key back to the bare pointer turns exactly those two pins red, restored to HEAD. S1: the BREAKING paragraph names the roll-up author, and the fix sentence and the entry's `replacement` carry D6's remedies. Nits: N1 (below), N2 ("the first four lines") and N3 (single save 200, batch writer "saved" in its own result) fixed; round-1 nits N1-N3 left. - **Review #3 (comment 6888559585) fixes, at `f1f49b351`:** M1 declared (option a): the `protocol-save.ts` hunk asks D6's roll-up door as well as the follow door, as the batch writer's extension row already did; the changeset, this table, the entry's `surface` and the `registry-question.ts` sentence now say so, and a pin holds it (422, nothing stored). M2: R7 compares the refused pair (kind, object, field, pointer or roll-up target), not the sentence, which lists the parent's code fields; pinned: a parent upgrade that only adds `cc` installs. M3: pinned: the extension package's own no-change upgrade installs (ablation of the extend arm's `replaced` capture turns exactly that pin red, restored to HEAD). M4: the changeset scopes R7 to runs and adds the unchanged-extension re-publish line for single save and the batch writer. - **Verification at `f1f49b351`:** `pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql test` under `os-verify-lock`: Test Files 595 passed (595), Tests 13099 passed (13099), VERDICT command-exit 0. The two touched test files: 65/65. `check:adr-0087-registration`, `check:spec-changes`, `check:upgrade-guide`, `check:nul-bytes`, `check:doc-authoring` and eslint over the 7 touched source files: exit 0. - **Main merge:** `origin/main` (with E1's objectstack-ai#33513) merged at `fb22e7bd1`, clean, no conflict in `registry.ts`; the PR's hunks were byte-identical before and after (review #3 checked the same). - **Follow-up: objectstack-ai#33628** (R5 / enable): whether uninstalling or disabling a supplier extension, and enabling a package, ask the follow door is NOT pinned here. By reading: `disablePackage` / `enablePackage` / `uninstallPackage` are not registration runs (`restoringOnRefusal` is not entered), so none asks the door; a disable that withholds a supplier's code field leaves a following amount served against a parent that no longer holds the code. - **Batch writer face** is pinned at the registry question the writer asks of a registered row (`objectRegistrationRefusal(..., { againstRegistry: true })`, as `batch-object-registration.ts` asks it), not by driving a protocol batch face end to end with an `object_extension` row. - **Decided (seat 5): A.** R7 covers runs (install, upgrade, reload). Single save and the batch writer are unchanged: they judge against the slot left empty, `main`'s answer, so a single save that re-saves an own body unchanged over a pair a cold boot admitted is still refused. - **Environment-overlay reading** (`followRefusalAsServed`): an extension layer's own fold uses the served base (the overlay when there is one); only the OTHER objects are re-read through their package definitions. - **Older ledger entry:** `18.record-currency-follow-pair-refused-on-install-and-reload.ts` is not edited (a registered entry). The new entry `18.record-currency-follow-extension-judged-as-served.ts` names it and says that, for runs, it supersedes that entry's sentence "although nothing in that package is wrong": such a run is now refused only when it changes the pair. - `packages/metadata-protocol/src/registry-question.ts` (E1's file, edited here with E1's OK): one header sentence, comment-only: "An `object_extension` item published on the same faces asks both record-currency doors too — D6's roll-up half (the roll-ups it adds, and a registered parent's roll-up over an amount it adds), and the follow door of the extension judged as its object will be served." ## Verification <details><summary>Review #3 delta fixes at `c29899531` — objectql full suite + typecheck green, ablation 2 red, gates 0</summary> `pnpm --filter @objectstack/objectql typecheck && pnpm --filter @objectstack/objectql test` under `os-verify-lock`, after `pnpm --filter '@objectstack/objectql^...' build`: ```text check:test-typecheck: OK — @objectstack/objectql's test layer compiles under packages/objectql/tsconfig.test.json Test Files 595 passed (595) Tests 13101 passed (13101) os-verify-lock: VERDICT command-exit 0 ``` The two touched test files: 67/67. `packages/spec` migrations tests (`migrations`, `semantic-relevance`, `spec-changes-surface-scope`): 187/187. Ablation: `node scripts/ablation-replace.mjs --file packages/objectql/src/record-currency-aggregate-door.ts` replacing the own-loop key's target with the bare pointer, then the two test files: ```text ablation-replace: ok mutation landed: anchor 1 -> 0, blob b6542b7 -> 97bc3261cc65 x [objectstack-ai#33593 R6] CONTROL: the child's upgrade that re-points the pair onto ANOTHER parent lacking the code is refused, though the pointer reads the same x R6: an extension upgrade that re-points its own master_detail onto ANOTHER parent lacking the code is refused, though the pointer reads the same Tests 2 failed | 65 passed (67) ablation-replace: blob after restore b6542b7 (== HEAD blob; git diff HEAD empty) ``` Gates: `pnpm check:adr-0087-registration` exit 0; `pnpm --filter @objectstack/spec check:spec-changes` exit 0; `check:upgrade-guide` exit 0; `check:nul-bytes` exit 0; `eslint --no-inline-config` over the four touched source/test files exit 0. Dogfood battery and dependents: not run in this round (ordered after the delta review). </details> Readings below the first two blocks were taken at `bb54e3a54` (merge base `c32bb6ccb`). The branch then merged `origin/main` at `fb22e7bd1` (E1's objectstack-ai#33513 had landed): the merge was clean, with no conflict in `registry.ts`. After `pnpm install --frozen-lockfile` and a rebuild of objectql's dependency closure, objectql `tsc --noEmit` passed, the two touched test files ran 62/62, and the full objectql suite was cut off by a container restart (NOT MEASURED at `fb22e7bd1`). <details><summary>objectql: full suite + typecheck — green</summary> `pnpm --filter @objectstack/objectql test && pnpm --filter @objectstack/objectql typecheck` (under `os-verify-lock`, at `56474fc2f`; the source has not changed since except the JSDoc commit) ```text Test Files 595 passed (595) Tests 13049 passed (13049) check:test-typecheck: OK — @objectstack/objectql's test layer compiles under packages/objectql/tsconfig.test.json os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>metadata-protocol: full suite + typecheck — green</summary> `pnpm --filter @objectstack/metadata-protocol test && pnpm --filter @objectstack/metadata-protocol typecheck` ```text Test Files 340 passed | 9 skipped (349) Tests 22877 passed | 43 skipped (22920) os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>Ablation (one, the behaviour the new pins hold) — 8 red, restored</summary> `node scripts/ablation-replace.mjs --file packages/objectql/src/registry.ts --anchor "if (served === undefined) return undefined;" --replacement "if (served === undefined || ownership === 'extend') return undefined;"` (an `extend` layer judged by nothing, the shape `main` had for the following half), then the two test files. objectql's tests import the registry from `src` by relative path, so no build sits between the mutation and the run. ```text ablation-replace: ok mutation landed: anchor 1 -> 0, blob 09c11d4 -> 3be4c89b9820 Test Files 2 failed (2) Tests 8 failed | 54 passed (62) x the three extension-only bad shapes (R1), R4, R5 missing, R5 disabled, single save, batch writer ablation-replace: ok restored: blob == HEAD (09c11d4) and `git diff HEAD` is empty ``` Direction as expected: the R3 cases (owner after the extension) stay green under this mutation, because the owner's own layer folds the extension in. </details> <details><summary>Lint and gates</summary> - `npx eslint --no-inline-config` over the six changed files: exit 0. - `pnpm check:adr-0087-registration`: exit 0, `registered record-currency-follow-extension-judged-as-served (new here)`. - Derived families (`node scripts/pm/dispatch-gates.mjs --commands`, 95 commands for 7 paths vs `c32bb6ccb`): run locally as of this body, all exit 0 except the ones below; the rest are left to CI's `Lint & Repo Gates` / `TypeScript Type Check`. - re-run after `pnpm --filter @objectstack/spec build`: `check:api-surface` (unchanged ✓), `check:exported-any`, `check:browser-reachable-entries`, `check:dual-source-exports`, `check:entry-nameability`: exit 0. - `check:dual-build-cjs-loads`, `check:lean-entry-closure`: exit 3 (PREREQUISITE NOT MET: no whole-repo build here, nothing measured), NOT MEASURED locally; CI runs them. `--ran`: 95 derived, 93 run, 2 UNRUN (these two). - After the two follow-up commits (the `registry-question.ts` sentence and the new entry's supersede sentence): the derivation over 8 paths gives the same 95 commands. `check:adr-0087-registration`, `check:spec-changes`, `check:upgrade-guide`, `check:liveness`, `check:nul-bytes`, `check:doc-authoring`, `check:issue-citations`, `check:cross-package-test-inputs` and eslint over both files: exit 0. - `test:repo` (vitest `repo` project, incl. `packages/runtime/src/metadata-registry-question-producers.test.ts`): NOT MEASURED locally, declared to CI's `Test Core`. The new `saveRegistryQuestion` call in `protocol-save.ts` adds no `saveMetaItem` / `promoteDraftForPublish` producer. - Direct dependents of objectql (runtime, rest, plugins): NOT MEASURED locally (deadline), declared to CI. - Full dogfood battery (title carries `!`): NOT MEASURED locally, declared to the queue's `Dogfood Regression Gate`. </details> Session: https://claude.ai/code/session_016WV4cz4f7zEQZ2C9GTG382 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: domain:server#5 · os-elon-musk · session_016WV4czrwT7WKAde95kC4cg --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…r row's bare-slot entry when the pair relation names no single base (ADR-0150 D5) (objectstack-ai#33825) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbNTugWasvhTMrtCZiFGrZYK)_ Fixes objectstack-ai#32620 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:租户删掉自己对"两个包同名项"的定制后,注册表修复(heal)现在会把该定制留在裸槽位里的条目清掉,不再挑任何一个包。 - 为什么改:此前删完后直到下次重载,点名该定制包的读取仍返回已删除的内容,点名两个原持有包的读取则被拒绝,且候选里是一个早已不存在的行(flow、permission 两种类型实测复现)。 - 风险与回滚:只改一处判断,清除动词本身仍拒绝删除打包制品,不会误删任何持有包的条目;回滚即 revert 本 PR,回到"记日志、条目保留、重载后自愈"。 - 先看:`packages/metadata-protocol/src/protocol-registry-hydration.ts` 中 `restoreArtifactRegistryView` 的 catch 分支(条件去掉 `boundPackageOf(packageId) !== undefined`),再看 `packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts` 新增的 describe。 - 两分钟验证:`pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/protocol-registry-heal-packageless-refusal.test.ts`,预期 7 个用例全绿。 - 需要你做的:无,席位落地。 ## What changes Ruling: epic seat ruling 6818436831 (`epic:objectstack-ai#31527#2`), seat ruling A, "extend the retire", on the same footing as seat ruling 6812637203 Q2. A stored row bound to a **non-holder** (an installed package holding no item of the name, ADR-0146) on a name two packages hold, where the pair relation names zero or several bases: after its delete, the heal's baseline read is refused and the walk stops with an `error` line. On `main` the removed row's bare-slot entry was then kept. It is now retired with `removeOverlayEntry`, the verb the package-less case (Q2) already uses, which refuses a packaged artifact. No holder is picked and no baseline is registered. **Declared move: entry kept → retired, `Clause-②: no`.** - `restoreArtifactRegistryView`'s catch: the retire no longer requires a package-less row. A package-scoped refusal is the only refusal `readHealBaseline` lets through for a bound row, and it reaches it only after the row's own package answered a settled miss, so the row is a non-holder's. A peer that does not know the binding (`HEAL_BINDING_UNKNOWN`) keeps the logged stop, as before. - `registryHealStoppedMessage` gains one case, `slot-retired`. For the package-slotted types whose bound row lives in its own package slot (objectstack-ai#33127), that slot is already retired above the catch, and the bare slot holds nothing to remove. The line said "the registry entry is left as it was and may serve the removed row". It now says the row's own package slot was retired. - No change to `protocol.ts`, the objectql registry, or any spec surface. ### Which types reproduced at `a557fa38` (the premise, measured) The measurement booted a real `SchemaRegistry` with a real `MetadataManager` holding two holders' items, hydrated one stored row bound to a non-holder, and then deleted it through `deleteMetaItem` naming that package. It covered every `PACKAGE_SLOTTED_METADATA_TYPES` member plus `dashboard` and `report`, in both registration orders, with and without composite holder slots in the registry. - **Reproduces: `flow`, `permission`**, with holders served by the service and no composite slot in the registry. Before the delete, the bare slot held `row:other`. After it, the bare slot still held `row:other`, the read naming the non-holder served `row:other`, and each holder's read was refused with the non-holder as its only candidate. These are exactly the card's three bullets. These two types are the package-slotted types excluded from `takesPackageOverlaySlot`, so their bound row sits in the bare slot. - **Does not reproduce:** `api`, `agent`, `skill`, `action`, `email_template`, `picklist`, `mapping`, `dataset`, `webhook`, `tool`, `connector`. objectstack-ai#33513 already retires the bound row's own package slot, and the bare slot is empty. For these types only the line changes. - With composite holder slots, nothing reproduces: either tier 1 heals or the delete door refuses (403 `NOT_OVERRIDABLE`). - **PM hypothesis 2 partly falsified.** `dashboard` and `report` never reach this branch, because their store is not package-slotted and the bare read is not refused (no heal line). `email_template` is clean. See Acceptance notes for what `dashboard` and `report` do instead. ## Tests - `packages/objectql/src/protocol-registry-heal-packageless-refusal.test.ts`: a new top-level describe on a real `SchemaRegistry`, sharing the file's one engine double. It covers `flow` and `permission`, each in both registration orders. Before the delete: the row is in the bare slot, and a holder's read is the 409 naming the non-holder. After it: the bare slot is empty, the non-holder's read serves nothing, each holder's read answers its own item, the bare read is the 409 naming both holders, the list shows the two holders only, and the line says the entry was retired. CONTROL `action`: the holders serve exactly as before, and the line says the row's own package slot was retired. - `packages/metadata-protocol/src/protocol.registry-heal-package-read.test.ts`: the recording-double pin "a row of a package that pairs no holder, on a name two packages hold" flips from `tier3: []` to `tier3: ['action|digest']` (the declared move). A sibling case covers the verb answering `false`, where the line says no entry was retired. **Ablation**, once: the fix was committed first, then the bound-row exclusion was put back through `scripts/ablation-replace.mjs`, with a marker that must reach `dist/`. - objectql pins resolve `@objectstack/metadata-protocol` through `dist/`, so the mutated package was rebuilt and `ablation-dist-preflight` passed (exit 0) before the run. The mutated run had **5 failed, 2 passed (7)**: all four flow/permission cases failed with `expected 'row:other' to be undefined`, and the CONTROL failed with `expected '[Protocol] the registry heal after th…' to contain 'retired from its own package's slot'`. After the restore, `git diff HEAD` was empty, the blob hash matched HEAD, the package was rebuilt, and the dist marker was absent. The restored run was 7 passed. - metadata-protocol pins resolve source. The mutated run had 2 failed, 15 passed (17); restored, 17 passed. - The first objectql ablation leg was a no-op: the lock queue timed out before the rebuild, and the preflight caught it (dist reading failed). That run was discarded and redone as above. ## Acceptance notes - `dashboard` and `report` (not package-slotted in the store), measured only in the no-composite shape. After a non-holder row's delete, tier 2's bare baseline read returns one holder's item, the one the service registered last, so the bare slot then serves that holder and the other holder's read is refused naming it. This branch is not this card's (no refusal, no heal line), and whether the no-composite shape is reachable for those types in a real boot was not measured. It is recorded for the seat, not filed. ## Verification Readings at head `7fce425024` (origin/main merged in), unless stated: - `@objectstack/metadata-protocol`: the whole suite passed, 340 files / 22884 tests, 9 files and 43 tests skipped, read at `6ba132b569`. The merge then changed `protocol-save.ts` and `registry-question.ts`, so the heal file was re-run at the head: 17/17. `typecheck` exit 0. - `@objectstack/objectql`: `typecheck` exit 0. The objectql closure was rebuilt after the merge, then the 29 test files that drive the delete heal (`restoreArtifactRegistryView`, `deleteMetaItem`, or a heal line) were run: 680/680 passed. The full objectql suite was NOT MEASURED locally, because the shared verify lock queue-timed out twice. That run is left to CI's `Test Core`. - Derived gates (`dispatch-gates --commands`, 67 families): 66 exited 0. `check:dual-build-cjs-loads` exited 3 with PREREQUISITE NOT MET (no full-repo `dist/` in this worktree), so it is NOT MEASURED and left to CI. `--ran` reconciliation: 67 derived, 67 run, 0 unrun. - ESLint over the three touched source and test files exited 0. PR body gates: `check-closing-keyword-parity` and `check-partof-closing-keyword` exited 0. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTkZnXtRhuEiiyidvJ --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Part of #33127 (its main case and the per-package overlay slot; the card stays open for its unpinned heal items: Heal 1, Heal 2 and S1)
Fixes #32900
Fixes #32663
Fixes #32662
Refs #32692
Clause-②: yes (narrowing)
Metadata-protocol: semantic
Skills-docs: none —
skills/**andcontent/docs/**teach no reading of a name two packages each store a row of (grepped?package=,.custom,409: the hits are the pair's save door, a flow's secret refusal and a permission grant), so no taught sentence moves; the read naming no package keeps its409and its?package=remedy.维护者速读
.custom配对包的行按配对规则归到它的基础包),不覆盖代码工件的条目。于是每个包的精确地址、注册表条目、配对地址都返回自己的那一行,不随保存顺序、加载顺序或重启变化。?package=返回出厂项而它自己的存储行没人读(metadata-protocol: after a restart, two stored rows of one name that each name a different holder leave only the last one loaded, for every package-slotted type (tool, webhook, …) #33127);写入方和对端副本的注册表条目只剩最后写的那一行(metadata-protocol: the writer's registry keeps one bare slot per stored name, so after one package saves a name two packages store, the other's exact address answers nothing (ADR-0150 D4) #32663);配对地址重启前 404、重启后一个 200 一个 409(metadata-protocol: after a reboot, the pair address X.custom of a name held only by stored rows of two enabled packages answers by hydration order (one 200, the other 409 naming one side) (ADR-0150 D3, red line 2) #32662);模块的 de-DE 语言成员跟着行顺序走(metadata-protocol: the registry's bare slot keeps only the row hydrated last when a pair row and a package-less row of the same member are both stored #32900)。packages/objectql/src/registry.ts的registerItem(新storedRowPackage选项与槽位键)、overlaySlotBinding末尾新分支、isBundleAddition的codeMembersOf;再看protocol-registry-hydration.ts的takesPackageOverlaySlot与restoreArtifactRegistryView的槽位清理。pnpm --filter @objectstack/objectql exec vitest run --project local src/webhook-stored-row-boot-hydration.test.ts src/protocol-cluster-signal-package.test.ts -t "33127|32663|32900",两种注册顺序、两种行顺序全部通过。Clause-②: yes (narrowing),受管面),然后席位落地。What changes
SchemaRegistrykept ONE bare slot per name for a stored row (registerItemwith no package), so the row saved or hydrated last took it, beside the code artifact's compositepkg:nameentry. Every symptom in this set is that one slot.The slot model (
packages/objectql/src/registry.ts).registerItem(type, item, keyField, packageId?, options?)takesoptions.storedRowPackage. Without apackageId, a row with a stored-row package registers under a package overlay slot key,MARK + package + MARK + bareKey, withMARKthe NUL character written as an escape in source. It never overwrites the bare key or a composite entry.bareSlotEntriesOfreads those slots after the bare entries, so every reader that judged the bare slot (overlaySlotBinding,packageScopedHoldersOf,getPackageScopedItem,boundServedActions,unregisterItem) sees each row once, bound by the same rule as before.rankedForPackageorders a package's bound rows as the stored-row read serves them: its pair's declared override, its own row, the package-less row, any other.orderedOverlayTierorders the overlay tier ofgetItemby holder (the caller's package first, then composite order, then id), sogetItemno longer follows row order.overlaySlotBinding: aBASE.customrow whose base holds the name only as its own stored row binds to the base, never becoming a second holder. That is the case one bare slot never held both rows of.isBundleAddition(…, codeMembersOf): a bundle member that two packages hold only as stored rows is no clash. One bare slot used to hold one of the two rows, so the base held the name in either order (protocol-bundle-member-base-address.test.tspins that answer, and it went red without this). A member either package ships in code still clashes.removePackageOverlaySlots(type, name, member, select)is new and public. It drops the selected packages' slots, for the delete's heal.Hydration (
packages/metadata-protocol/src/protocol-registry-hydration.ts).hydrateOverlayIntoRegistrypassesstoredRowPackagefor a row bound to a package of a type inPACKAGE_SLOTTED_STORE_TYPES, lessflowandpermission, which keep their own slot rules (takesPackageOverlaySlot).restoreArtifactRegistryViewretires the removed package's slot. Tier 1's bare-entry drop runs only when no slot was retired, and a heal with an unknown binding drops the slots of packages with no remaining row.Reads (
packages/metadata-protocol).admitExactQualifier(…, { storedRowBases }): a pair address of a name its bases hold only as stored rows is admitted at the base whose row is stored. Two such bases are refused naming both, as two registry bases are.readMetaItemasks for it and reads that base's content.storedRowHoldersRefusalserves the read naming no package at the one holder whose rows are its own and its pair's (metadata-protocol: after a reboot, the pair address X.custom of a name held only by stored rows of two enabled packages answers by hydration order (one 200, the other 409 naming one side) (ADR-0150 D3, red line 2) #32662 scope note b). It used to fall through to the first-stored row.Moved answers (FROM
maind4fbb4d → TO), per door:GET /meta/TYPE/NAME?package=ID, two shippers each with a stored row (tool, webhook, agent, skill), after a restartgetPackageScopedItem, writer and peer, after alpha then beta saved (action, tool, email_template)[null, beta](mirror in the other order)[alpha, beta]GET /meta/TYPE/NAME?package=ID.custom, name held only as stored rows (dashboard, tool, action), before a restartGET /meta/TYPE/NAME(and/published), a package's row beside its own pair's undeclared rowGET /meta/action/NAME, two packages hold it only as stored rows, after a restartRESOURCE_CONFLICTnaming both (the narrowing)getPackageScopedItem('email_template', welcome, X, 'de-DE'), X's pair row beside a package-less de-DE rowgetPackageScopedItem('action', …), both shippers with a declared override (#33131's carried face)ADR-0087: the semantic entry
stored-row-own-package-slot(packages/spec/src/migrations/entries/semantic/18.stored-row-own-package-slot.ts), markeradr-0087: registered stored-row-own-package-slotin.changeset/33127-stored-row-own-package-slot.md.Tests
Head
8d85d2b1af. Pins, each in every registration, save and row order, with CONTROLs (one holder, one row, a package-less row: unchanged). Each pin went in as a top-leveldescribein the file that already holds its harness.packages/objectql/src/webhook-stored-row-boot-hydration.test.ts:[#33127]covers tool, webhook, agent and skill: both holders ship the name, each stores a row. It checks the registry slot, the exact read, and that the read naming no package answers409 RESOURCE_CONFLICTnaming both.[#32900]checks X's de-DE slot in both row orders.packages/objectql/src/protocol-cluster-signal-package.test.ts,[#32663]: action, tool and email_template, writer and peer, both save orders.packages/runtime/src/domains/meta-disabled-holder-served-stack.test.ts,[#33127, #32662], throughHttpDispatcheron a booted kernel over a sqlite file, before and after a reboot:?package=per holder;?package=ID.custom;/published.The
[#32607 M1]test now also pins the base row on all three faces in both orders.Moved pins:
protocol-flow-custom-override.test.ts[#33131]: the carried registry face moved to its TO.protocol.register-item-call-sites.test.ts: the ledger records the newregisterItemcall shape.scripts/engine-double-contract.pinned.json: ratcheted with--write.Local runs (under `scripts/pm/os-verify-lock.sh`)
Tests 144 passed (144); runtime served-stack,Tests 36 passed (36); metadata-protocol call sites,Tests 5 passed (5).TC_EXIT=0.pnpm exec turbo run test --concurrency=2 --continueover the 83 packages that depend on objectql, metadata-protocol or runtime, plus@objectstack/spec. Result:Tasks: 186 successful, 188 total. The two failed tasks:@object-ui/example-schema-catalog#testprintedsh: 1: vitest: not found. That example's install is missing on this box; nothing was measured (NOT MEASURED).@objectstack/dogfood#test(the full battery, no shard):Test Files 2 failed | 463 passed | 3 skipped (468),Tests 2 failed | 3930 passed | 42 skipped (3974). Both failures wereTest timed out in 5000mswhile the box was contended:bare-name-one-holder-ai-family[#31985]andpackage-commit-revert-path-package[#29414] control. Re-run alone under the lock (VERDICT command-exit 0):Test Files 2 passed (2),Tests 39 passed (39).pnpm lintpassed (LINT_EXIT=0).Ablations: one per negative pin, each restored with a clean whole tree
Each mutation went through
scripts/ablation-replace.mjs.metadata-protocolwas rebuilt andscripts/ablation-dist-preflight.mjsfound the marker indist/. After the restore it was rebuilt again and the preflight with--absentanswered exit 0.overlaySlotforced off (markerABLATION_33127_SLOT):27 failed | 117 passed (144). The red tests are exactly the[#33127]boot pins (16),[#32663](6),[#33131]'s moved pin (4) and[#32900]pair-first (1).2 failed, the two#33127door pins.readMetaItem'sstoredRowBasesoff: runtime4 failed, the four#32662pair-address pins. objectql stayed green.storedRowHoldersRefusal's one-holder arm off (markerABLATION_33127_PLAINB): runtime3 failed, the two#32662 (b)pins andM1.isBundleAddition's row-only exemption off: objectql1 failed,[#28802] with a dependent's member at the same locale, the base's address still serves the pair's.Acceptance notes
protocol-flow-custom-override.test.tsmoved to the TO, and its title no longer says carried. That card stays open for its seat to judge.dashboardis still converged by name in the registry (metadata-protocol: the writer's registry keeps one bare slot per stored name, so after one package saves a name two packages store, the other's exact address answers nothing (ADR-0150 D4) #32663 residual (a), awaiting a ruling). The metadata-protocol: a cluster peer's metadata convergence re-reads and heals a removed row with no package, so a slotted type's peer can restore another package's item (ADR-0150 D4) #32451 CONTROL stays as it was.getMetaItemLayered) at a pair address is unchanged.registry.tsbelong to area E2b. Its open PRs (fix(objectql): judge an authored action artifact-shipped by each holder's owner key, not by bare name #33271, fix(runtime)!: the action route answers by who holds the name on the route, and the environment address answers its own item #33274) touch neitherregistry.tsnor any file here; fix(objectql): judge an authored action artifact-shipped by each holder's owner key, not by bare name #33271 reads composite keys inplugin.ts, which this change leaves as they were.Verification
pnpm check:adr-0087-registration:1 declared-breaking changeset(s), each carrying an ADR-0087 disposition … registered stored-row-own-package-slot.node scripts/pm/dispatch-gates.mjs --commands, 102 families on this diff) were run locally.check:dual-build-cjs-loadsasks for a whole-repopnpm buildfirst, so it is NOT MEASURED here and left to CI.check:engine-double-contractandcheck:objectql-double-limitwere red on the first pass because of a new unboundedfinddouble. After the fix they are exit 0.check-nul-bytes: OK. The overlay slot mark is written as an escape, never a raw byte.packages/objectql/src/registry.ts: none (fix(objectql): judge an authored action artifact-shipped by each holder's owner key, not by bare name #33271 and fix(runtime)!: the action route answers by who holds the name on the route, and the environment address answers its own item #33274 were checked file by file).pnpm --filter @objectstack/objectql exec vitest run --project local src/webhook-stored-row-boot-hydration.test.ts -t 33127.🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn